package github_rss

case class UserAction(
  id:UserActionID,
  url:String,
  title:String,
  summary:String
) {
  
  def tweetString:String = {
    List(
      Googl.getShortUrl(url)
      ,"#rpscala"
      ,title
      ,summary
    ).mkString(" \n").take(140).replace("@"," ")
  }
}

object UserAction{  
  def apply(rawData:xml.Node):UserAction = {
    UserAction(
      (rawData \ "id").text,
      (rawData \\ "@href").text,
      (rawData \ "title").text,
      (rawData \ "summary").text.replaceAll("<.+?>"," ")
    )
  }
}